<div class="clear_both"></div>
<div class="main_container">
<fieldset style="min-height:200px">
	<legend>Payroll Journal</legend>
	<?php echo form_open('report/export');?>
	<table>
		<tr>
			<td width="100">Payroll Period</td>
			<td>
				<select id="payroll_period_id" name="payroll_period_id">
				<option value="">-- Select --</option>
				<?php foreach($periods as $p):?>
					<option value="<?php echo $p->id?>"><?php echo DateUtils::formatDate($p->date_start, ConstantsUtils::$DATE_FRIENDLY_FORMAT). " to " .DateUtils::formatDate($p->date_end, ConstantsUtils::$DATE_FRIENDLY_FORMAT) ;?></option>
				<?php endforeach;?>
				</select>
			</td>
		</tr>
		<tr>
			<td width="100">&nbsp;</td>
			<td>
				<input type='hidden' name='template' value="payroll_journal" />
				<input type="submit" id="export" name="export" value="Export XLS" />
			</td>	
		</tr>
	</table>
	<?php echo form_close();?>
</fieldset>
</div>

<script>
$(document).ready(function() {
	$('#export').click(function (){
		$period_id = $('#payroll_period_id').val();
		if($period_id == '') {
			alert('Please select payroll period.');
			return false;		
		}
	})
})

</script>